package com.jacken.mars.commons.mq.base.producer;

import org.apache.rocketmq.client.producer.DefaultMQProducer;
import org.apache.rocketmq.client.producer.SendResult;
import org.apache.rocketmq.client.producer.SendStatus;
import org.apache.rocketmq.common.message.Message;
import org.apache.rocketmq.common.message.MessageQueue;

/**
 * @author wangqiang
 * @version 1.0
 * @date 2021/1/3 16:23
 */
public class OneWayProducer {
    public static void main(String[] args) throws Exception {
        DefaultMQProducer producer = new DefaultMQProducer("group-01");
        producer.setNamesrvAddr("114.55.146.111:9876");
        producer.start();

        for (int i = 0; i < 3; i++) {
            Message message = new Message("OneWay-producer", "Tag-03", "hello world单向消息".getBytes());
            producer.sendOneway(message);
            Thread.sleep(1000);
        }
        producer.shutdown();

    }
}
